package biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import dao.MemoDao;
import entity.Memo;
import biz.MemoBiz;

public class MemoBizImpl implements MemoBiz {
	private MemoDao memoDao;

	
	public List<Memo> findAll() {
		return memoDao.findAll();
		
	}

	public Memo findById(Integer id) {
		return memoDao.findById(id);
	}

	public List<Memo> findByParam(Map map) {
		return memoDao.findByParam(map);
	}

	public int add(Memo memo) {
		return memoDao.add(memo);
	}

	public int delete(Memo memo) {
		return memoDao.delete(memo);
	}

	public int update(Memo memo) {
		return memoDao.update(memo);
	}
	
	public List<Memo> findByPage(Integer pageNo, Integer rows) {
		Map map = new HashMap();
		map.put("start", (pageNo-1)*rows+1);
		map.put("end", pageNo*rows);
		return memoDao.findByPage(map);
	}

	public Integer count() {
		return memoDao.count();
	}
	
	public MemoDao getMemoDao() {
		return memoDao;
	}

	public void setMemoDao(MemoDao memoDao) {
		this.memoDao = memoDao;
	}

	public List<Memo> findByUserId(Integer id) {
		return memoDao.findByUserId(id);
	}

	

}
